home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 401-425 / disk_405 / gifmachine / sources / gifmachine.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  103 lines

  1. /* Copyright 1990 by Christopher A. Wichura.
  2.    See file GIFMachine.doc for full description of rights.
  3. */
  4.  
  5. #include <exec/types.h>
  6. #include <exec/lists.h>
  7. #include <exec/nodes.h>
  8. #include <proto/dos.h>
  9. #include <proto/exec.h>
  10. #include <string.h>
  11. #include <stdlib.h>
  12.  
  13. /* some structures to make parsing the gif files a bit easier */
  14. struct GIFdescriptor {
  15.     UWORD gd_Width;
  16.     UWORD gd_Height;
  17.     UBYTE gd_ColInfo;
  18.     UBYTE gd_BackGround;
  19.     UBYTE gd_PixelAspect;    /* Aspect Ratio = (Pixel Aspect + 15) / 64 */
  20. };
  21.  
  22. struct ImageDesc {
  23.     UWORD id_Left;
  24.     UWORD id_Top;
  25.     UWORD id_Width;
  26.     UWORD id_Height;
  27.     UBYTE id_Info;
  28. };
  29.  
  30. struct RGB {
  31.     UBYTE rgb_Red;
  32.     UBYTE rgb_Green;
  33.     UBYTE rgb_Blue;
  34. };
  35.  
  36. #define GIF_IMAGE      0x2C
  37. #define GIF_EXTENSION  0x21
  38. #define GIF_TERMINATOR 0x3B
  39.  
  40. #define GIF_COMMENT_EXT 0xFE
  41.  
  42. #define MAXCOLOURS 4096
  43.  
  44. /* these next macros are used to get the r, g, and b values of a given
  45.    index */
  46. #define GetRed(a)    (UBYTE)(a >> 8)
  47. #define GetGreen(a)    (UBYTE)((a >> 4) & 0xF)
  48. #define GetBlue(a)    (UBYTE)(a & 0xF)
  49.  
  50. /* whenever we want to abort we will return this as our error code */
  51. #define ABORTEXITVAL 1
  52.  
  53. /* this struct is used to hold the linked list of comments found in the GIF
  54.    file so that each can be written as a seperate ANNO chunk. */
  55. struct CommentNode {
  56.     struct MinNode cn_Node;
  57.     char *cn_Comment;
  58.     ULONG cn_CommentLength;
  59. };
  60.  
  61. /* function prototypes we use */
  62. extern int __regargs main(char *cmdptr, int cmdlen, struct WBStartup *WBMsg);
  63. extern void    WarnMustUseCLI(void);
  64. extern void    DoPattern(char *);
  65. extern void    Convert(char *);
  66. extern BOOL    IsDir(char *);
  67. extern void    FlipWord(UWORD *);
  68. extern BOOL    DoImage(BPTR);
  69. extern BOOL    DoExtension(BPTR);
  70. extern BOOL    WriteIFF(char *, BOOL);
  71. extern void    PutValue(UWORD, UWORD, UWORD);
  72. extern UWORD    GetValue(UWORD, UWORD);
  73. extern int    ReadCode(BPTR);
  74. extern void    AddPixel(UBYTE);
  75. extern void    StripBorder(void);
  76. extern BOOL    BorderCheck(UWORD, UWORD);
  77. extern void    DoXComp(void);
  78. extern void    GIFtoSHAM(void);
  79. extern void    InitDiff(void);
  80. extern ULONG    RGBdiff(UBYTE, UBYTE, UBYTE, UBYTE, UBYTE, UBYTE);
  81. extern void    OutDump(int);
  82. extern void    OutRun(int, int);
  83. extern void    InitMemory(void);
  84. extern char *    MyAlloc(ULONG);
  85. extern void    MyFree(char *);
  86. extern void    FreeAll(UWORD);
  87. extern void    MyExit(ULONG);
  88. extern void    DoXFlip(void);
  89. extern void    DoYFlip(void);
  90. extern void    ReduceTo12(void);
  91. extern void    DitherTo12(void);
  92. extern UWORD    AddColour(struct RGB *);
  93. extern void __stdargs MyPrintf(char *, ...);
  94. extern void __stdargs MySPrintf(char *, char *, ...);
  95.  
  96. /* modules that want to use the Get/PutValue macros should include this
  97.    next macro to externally reference the picture storage array */
  98. #define EXTERNBITPLANE extern struct RGB **BitPlane
  99.  
  100. /* for use once colour palette has been reduced to 12 bits */
  101. #define GetValue(a, b) *((UWORD *)&BitPlane[b][a])
  102. #define PutValue(a, b, c) *((UWORD *)&BitPlane[b][a]) = c
  103.